import {defineStore} from "pinia";
import {ref, watch} from "vue";

export const useStore = defineStore('useStore', {
    state: () => ({

        admin: ref ({
            email: '',
            avatar: 'http://thirdqq.qlogo.cn/g?b=sdk&k=2Go7sVE93WlW4XOLyx4JeQ&kti=ZSqOlwAAAAI&s=140&t=1697285370',
            token: ''
        }),

        showAlbumDetail: ref(false),
        rowId: ref()

    }),
    getters: {

    },

    actions: {
        login(token, email) {
            this.token = token
            this.email = email
        },
        logout() {
            this.admin = {
                email: '',
                avatar: '',
                token: ''
            };
        }
    },
    persist: {
        enabled: true, // 开启缓存  默认会存储在本地localstorage
        storage: localStorage, // 缓存使用方式
        paths: ['admin' ]
    }
})



